package org.eae.eldf.webapp.vo;

import java.util.ArrayList;
import java.util.List;

public class CheckboxZtreeVo {
	private Long id;
	private String pId;
	private String name;
	private String parentId;
	private boolean leaf;
	private List<CheckboxZtreeVo> children=new ArrayList<CheckboxZtreeVo>();
	public boolean isLeaf() {
		return leaf;
	}
	public void setLeaf(boolean leaf) {
		this.leaf = leaf;
	}
	
	public List<CheckboxZtreeVo> getChildren() {
		return children;
	}
	public void setChildren(List<CheckboxZtreeVo> children) {
		this.children = children;
	}
	public String getpId() {
		return pId;
	}
	public void setpId(String pId) {
		this.pId = pId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getParentId() {
		return parentId;
	}
	public void setParentId(String parentId) {
		this.parentId = parentId;
	}
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public void removeNoRight(){
    	int size=children.size();
    	CheckboxZtreeVo node;
    	for(int i=size-1;i>=0;i--){
    		node=children.get(i);
    		node.removeNoRight();
    		if((!node.isLeaf())&&node.getChildren().size()==0)
    		{	 
    			children.remove(i);
    		}
    	}
    }
	
}
